//
//  HomeCollectionViewLayout.swift
//  ImageBrowse
//
//  Created by zs on 16/6/18.
//  Copyright © 2016年 zs. All rights reserved.
//

import UIKit

class HomeCollectionViewLayout: UICollectionViewFlowLayout {
    override func  prepareLayout() {
        super.prepareLayout()
    
        //0.定义常量
        let cols : CGFloat = 3
        let margin : CGFloat = 10
        let itemWH = (UIScreen.mainScreen().bounds.width - (cols + 1) * margin) / cols - 0.0001
        
        
        //1.设置布局
        itemSize = CGSize(width: itemWH, height: itemWH)
        minimumLineSpacing = margin
        minimumInteritemSpacing = margin
        
         collectionView?.contentInset = UIEdgeInsets(top: 64, left: margin, bottom: 0, right: margin)
    }
}
